package com.hrabun.goodmorningalarm;

import java.util.ArrayList;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class AutoStartAlarms extends BroadcastReceiver {

	private final String BOOT_COMPLETED_ACTION = "android.intent.action.BOOT_COMPLETED";
	ArrayList<AlarmItem> aItems;
	Database db;
	
	@Override
	public void onReceive(Context context, Intent intent) {
		if (intent.getAction().equals(BOOT_COMPLETED_ACTION)) {
			db = new Database(context);
			aItems = db.getAllActiveAlarms();
			for (AlarmItem aItem : aItems) {
				aItem.activate();
				Log.i("MY", aItem.alarmTime.toString() + " re-activate!");
			}
		}

	}

}
